import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
import { getPriceDetailApi } from '@/api/price'
export const useWaterPriceStore = defineStore('waterPrice', () => {
    const priceDetail = ref([])
    const lastPriceDetail = ref([])
    const getPriceDetail = async (data) => {
        let res = await getPriceDetailApi(data)
        if (data.area_id) {
            res.data = {
                ...res.data,
                areas: [res.data]
            }
        }
        console.log(res.data);

        priceDetail.value = res.data
    }
    const getLastPriceDetail = async (data) => {
        let res = await getPriceDetailApi(data)
        lastPriceDetail.value = res.data
    }
    return {
        priceDetail,
        lastPriceDetail,
        getPriceDetail,
        getLastPriceDetail
    }
})